<?php

namespace App\Admin\Controllers;

use App\Models\Order;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class OrderController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new Order(), function (Grid $grid) {
            $grid->column('no');
            $grid->column('express_no');
            $grid->column('price');
            $grid->column('name');
            $grid->column('phone');
            $grid->column('email');
            $grid->column('line_id');
            $grid->column('address');
            $grid->column('remarks');
            $grid->column('admin_remarks');
            $grid->column('ip');
            $grid->column('ipcountry');
            $grid->column('ship_at');
            $grid->column('sign_at');
            $grid->column('status');
            $grid->column('is_confirm');
            $grid->column('created_at');

        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new Order(), function (Show $show) {
            $show->field('id');
            $show->field('no');
            $show->field('price');
            $show->field('freight');
            $show->field('product_price');
            $show->field('delivery_type');
            $show->field('express_no');
            $show->field('name');
            $show->field('phone');
            $show->field('email');
            $show->field('line_id');
            $show->field('city');
            $show->field('county');
            $show->field('street');
            $show->field('address');
            $show->field('shop_no');
            $show->field('shop_name');
            $show->field('remarks');
            $show->field('admin_remarks');
            $show->field('ip');
            $show->field('ipcountry');
            $show->field('user_agent');
            $show->field('ship_at');
            $show->field('sign_at');
            $show->field('settle_at');
            $show->field('status');
            $show->field('is_confirm');
            $show->field('is_settle');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new Order(), function (Form $form) {
            $form->display('id');
            $form->text('no');
            $form->text('price');
            $form->text('freight');
            $form->text('product_price');
            $form->text('delivery_type');
            $form->text('express_no');
            $form->text('name');
            $form->text('phone');
            $form->text('email');
            $form->text('line_id');
            $form->text('city');
            $form->text('county');
            $form->text('street');
            $form->text('address');
            $form->text('shop_no');
            $form->text('shop_name');
            $form->text('remarks');
            $form->text('admin_remarks');
            $form->text('ip');
            $form->text('ipcountry');
            $form->text('user_agent');
            $form->text('ship_at');
            $form->text('sign_at');
            $form->text('settle_at');
            $form->text('status');
            $form->text('is_confirm');
            $form->text('is_settle');
        
            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
